using System;
using System.Collections.Generic;
using UnityEngine;

namespace LFromeWork
{
    public class PoolManager : IDisposable
    {
        /// <summary>
        /// 游戏物体对象池
        /// </summary>
        public GameObjectPool GoPool { get; private set; }
        
        /// <summary>
        /// 类对象池
        /// </summary>
        public ClassObjectPool CoPool { get; private set; }

        public void Init()
        {
            GoPool = new GameObjectPool();
            CoPool = new ClassObjectPool();

            InitClassReside();
        }

        /// <summary>
        /// 初始化常用类常驻数量
        /// </summary>
        private void InitClassReside()
        {
            CoPool.SetResideCount<HttpRoutine>(3);
            CoPool.SetResideCount<AssetBundleRefEntity>(10);
            CoPool.SetResideCount<AssetRefEntity>(10);
        }
        
        public void OnUpdate()
        {
            CoPool.OnUpdate();
        }

        public void Dispose()
        {
            GoPool.Dispose();
        }
        
    }
}
